def averageOfNumbersLessThanN(numbers: List[Int], n: Int): Double = {
  val filteredNumbers = numbers.filter(_ < n)
  if (filteredNumbers.isEmpty) {
    0.0
  } else {
    filteredNumbers.sum.toDouble / filteredNumbers.length
  }
}
val numbers = List(1, 2, 3, 4, 5, 6)
println(averageOfNumbersLessThanN(numbers, 4))